package openase.audiosearch.comm.request.decoder.facade;

import java.nio.ByteBuffer;

import openase.audiosearch.comm.request.Request;
import openase.audiosearch.comm.request.RequestType;
import openase.audiosearch.comm.request.decoder.RequestDecoder;
import openase.audiosearch.comm.request.decoder.factory.RequestDecoderFactory;

public abstract class RequestDecoderFacade {

	public static Request decode(ByteBuffer input) {
		byte code = input.get();
		RequestType requestType = RequestType.getType(code);

		RequestDecoder<?> decoder = RequestDecoderFactory.getDecoder(requestType);
		return decoder.decode(input);
	}
}
